<template>
    <div class="viewport">
        <div class="row">
            <div class="col-lg-12 text-right">
                <button class="btn btn-primary" @click.prevent="add_show=true"> 新 增 </button>
                <input type="text" class="form-control" v-model="test" @keypress.enter="testin">
            </div>
        </div>
        <div class="row">
                <div class="col-lg-12">
                    <div class="flex-list table-style table-striped-style">
                        <div class="flex-row title-row">
                            <div class="flex-1 flex-col">订单号</div>
                            <div class="flex-5 flex-col">状态</div>
                            <div class="flex-2 flex-col">下单时间</div>
                            <div class="flex-3 flex-col">订单菜品</div>
                            <div class="flex-2 flex-col">客户名</div>
                            <div class="flex-2 flex-col">操作</div>
                        </div>
                        <!-- <div class="flex-list-body">
                            <template v-for="(item,i) in $root.CHECKLIST_LIST">
                                <div class="flex-row" :key="item.id">
                                    <div class="flex-1 flex-col">{{i+1}}</div>
                                    <div class="flex-5 flex-col">{{item.name}}</div>
                                    <div class="flex-2 flex-col">{{item.case_id}}</div>
                                    <div class="flex-3 flex-col">{{item.is_adv | advStr}}</div>
                                    <div class="flex-2 flex-col">{{item.created_user}}</div>
                                    <div class="flex-3 flex-col">{{item.created_time}}</div>
                                    <div class="flex-2 flex-col">
                                        <a href="###" @click.prevent="viewCL(item)">查看</a>&nbsp;&nbsp;
                                        <a href="###" @click.prevent="setEditCL(item)">编辑</a>&nbsp;&nbsp;
                                        <a href="###" @click.prevent="delCL(item)">删除</a>
                                    </div>
                                    <div class="flex-1 flex-col">
                                        <a href="###" @click.prevent="moveU(item)">上移</a>&nbsp;&nbsp;
                                        <a href="###" @click.prevent="moveD(item)">下移</a>
                                    </div>
                                </div>
                            </template>
                        </div> -->
                    </div>
                </div>
            </div>

            <!-- <AddChecklistModal :open="add_show" @close="add_show=false" @addcldone="addCLDone"></AddChecklistModal>
            <EditChecklistModal :checklist-id="edit_id" :open="edit_show" @close="edit_show=false" @editcldone="editCLDone"></EditChecklistModal>
            <ViewChecklistModal :checklist-id="view_id" :open="view_show" @close="view_show=false" ></ViewChecklistModal> -->
            
            
    </div>
</template>
<script>
    import SendOrderModal from '../components/order/SendOrderModal.vue'
    import ViewOrderModal from '../components/order/ViewOrderModal.vue'
    import {tip,ajax} from '../tools/tools.js'

    export default {
        components: {
            SendOrderModal,
            ViewOrderModal
        },
        data() {
            return {
                add_show:false,

                view_id:'',
                view_show:false,

                edit_id:'',
                edit_show:false,
                test:''
                
            }
        },
        watch: {
            
        },
        filters:{
            typeStr(v){
                var sObj = {
                    '1':'静态',
                    '2':'RMS',
                    '3':'人工'
                }

                return sObj[v];
            },
            advStr(v){
                var sObj = {
                    '0':'否',
                    '1':'是'
                }

                return sObj[v];
            }
        },
        methods: {
            testin(){
                alert(this.test)
            },

            getChecklistList(){
                var self = this;
                // ajax.getChecklistList({
                //     param:{},
                //     cb(data){
                //         self.$root.CHECKLIST_LIST = data.data;
                //     }
                // });
            },
            addCLDone(){
                var self = this;
                self.add_show = false;
                self.getChecklistList();
            },
            viewCL(item){
                var self = this;
                self.view_id = item.id;
                self.view_show = true;
            },
            setEditCL(item){
                var self = this;
                self.edit_id = item.id;
                self.edit_show = true;
            },
            editCLDone(){
                var self = this;
                self.edit_id = '';
                self.edit_show = false;
                self.getChecklistList();
            },
            delCL(item){
                var self = this;
                tip.warn('暂无该功能');
                return;
                ajax.delChecklist({
                    param:{
                        id:item.id
                    },
                    cb(data){
                        self.getChecklistList();
                    }
                })
            },
            moveU(item){
                var self = this;
                ajax.sortChecklist({
                    param:{
                        id:item.id,
                        sort:1
                    },
                    cb(data){
                        self.getChecklistList();
                    }
                })
            },
            moveD(item){
                var self = this;
                ajax.sortChecklist({
                    param:{
                        id:item.id,
                        sort:0
                    },
                    cb(data){
                        self.getChecklistList();
                    }
                })
            }
        },
        mounted(){
            
        }
    }
</script>
<style scoped>
    
</style>